<%--
  ** Copyright(c) 2005 BroadVision, Inc. All rights reserved.
  **
  ** This software is copyrighted.  Under the copyright laws, this software
  ** may not be copied, in whole or in part, without prior written consent
  ** of BroadVision, Inc. or its assignees. This software is provided under
  ** the terms of a license between BroadVision and the recipient, and its
  ** use is subject to the terms of that license.
  **
  ** This software may be protected by one or more U.S. and International
  ** patents. Certain applications of BroadVision One-To-One software are
  ** covered by U.S. patent 5,710,887.
  **
  ** TRADEMARKS: BroadVision and the BroadVision logo are registered
  ** trademarks, and BroadVision One-To-One is a trademark of BroadVision,
  ** Inc. IONA and Orbix are trademarks of IONA Technologies, Ltd. RSA,
  ** MD5, and RC2 are trademarks of RSA Data Security, Inc. All other
  ** trademarks, service marks, and trade names belong to their respective
  ** owners. BroadVision, Inc. disclaims any proprietary interest in the
  ** marks and names of others.
  --%>

<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el" %>
<%@ taglib uri="/WEB-INF/struts-bean-el.tld" prefix="bean-el" %>

<%@ page import="com.broadvision.report.admin.ReportConfig" %>
<%@ page import="com.broadvision.report.admin.JDBCResourceConfig" %>
<%@ page import="com.broadvision.report.jdbc.ConnectionInfo" %>

<%
  final String ctxPath = request.getContextPath();

  final JDBCResourceConfig model =
          (JDBCResourceConfig)request.getAttribute("resourceConfigModel");
  final ConnectionInfo info = model.getConnectionInfo();

  final boolean thruJndi = info.isThroughJndi();
  final String subTitleKey = thruJndi
      ? "bp.report.jdbcResourceView.subtitle.jdbc.datasource"
      : "bp.report.jdbcResourceView.subtitle.jdbc.driver";

  pageContext.setAttribute("resource", model);
  pageContext.setAttribute("dataSourceMode", new Boolean(thruJndi));
%>

<script language="Javascript">
  function doResourceDeleteAction(form)
  {
    var msg = '<bean-el:message key="bp.report.resource.confirm.delete" bundle="bp.messages"/>';

    if (!confirm(msg))
      return false;

    form.action = '<html-el:rewrite page="/bp/reportResourceDelete.do"/>';
    form.submit();
    return true;
  }
  function doResourceEditAction(form)
  {
    form.action = '<html-el:rewrite page="/bp/reportResourceEdit.do"/>';
    form.submit();
    return true;

  }
</script>

<table class="zoneFive" summary="resource config"
       width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td valign="top" width="100%">
      <div class="pageTitle">
        <bean-el:message
          key="bp.report.jdbcResourceView.title"
          bundle="bp.messages"
          arg0="<%=model.getName()%>"
        />
      </div>
      <div class="errorMessage">
          <html-el:errors bundle="bp.messages" />
      </div>

      <form method="POST" action="<%=ctxPath%>/bp/reportResourceEdit.do">
        <input type="HIDDEN" name="name" value="<%=model.getName()%>">

        <div class="pageSubtitle">
          <span class="left">
            <bean-el:message key="<%=subTitleKey%>" bundle="bp.messages"/>
          </span>
          <span class="right">
            <c:set var="editButtonValue">
              <bean-el:message key="button.edit" bundle="bp.messages"/>
            </c:set>
            <c:set var="deleteButtonValue">
              <bean-el:message key="button.delete" bundle="bp.messages"/>
            </c:set>
            <input class="inputButton" type="SUBMIT" name="editBtn"
                   value="<c:out value="${editButtonValue}"/>"
                   onclick="return doResourceEditAction(this.form);">
            <input class="inputButton" type="SUBMIT" name="deleteBtn"
                   value="<c:out value="${deleteButtonValue}"/>"
                   onclick="return doResourceDeleteAction(this.form);">
          </span>
        </div>
      </form>

      <!--start main content area here-->
      <table class="labelForm"
             width="100%" border="0" cellspacing="0" cellpadding="0"
             summary="resource config info">
        <c:choose>
          <c:when test="${dataSourceMode}">
            <!-- JDBC data source -->
            <tr>
              <td valign="middle" width="16%" class="label">
                <bean-el:message
                  key="bp.report.jdbcResourceView.label.jndi"
                  bundle="bp.messages"
                />:
              </td>
              <td valign="middle" width="34%" class="labelField">
                <c:out value="${resource.jndi}"/>&nbsp;
              </td>
              <td valign="middle" width="16%" class="label">
                <bean-el:message
                  key="bp.report.jdbcResourceView.label.pool"
                  bundle="bp.messages"
                />:
              </td>
              <td valign="top" width="34%" class="labelField">
                <c:out value="${resource.pool}"/>&nbsp;
              </td>
            </tr>
            <tr>
              <td valign="middle" width="16%" class="label">
                <bean-el:message
                  key="bp.report.jdbcResourceView.label.user"
                  bundle="bp.messages"
                />:
              </td>
              <td valign="top" width="34%" class="labelField">
                <c:out value="${resource.user}"/>&nbsp;
              </td>
              <td valign="middle" width="16%" class="label">
                <bean-el:message
                  key="bp.report.jdbcResourceView.label.password"
                  bundle="bp.messages"
                />:
              </td>
              <td valign="top" width="34%" class="labelField">
                <c:if test="${!empty resource.password}">*****</c:if>&nbsp;
              </td>
            </tr>
          </c:when>

          <c:otherwise>
            <!-- JDBC driver -->
            <tr>
              <td valign="middle" width="16%" class="label">
                <bean-el:message
                  key="bp.report.jdbcResourceView.label.driver"
                  bundle="bp.messages"
                />:
              </td>
              <td valign="top" width="34%" class="labelField">
                <c:out value="${resource.driver}"/>&nbsp;
              </td>
              <td valign="middle" width="16%" class="label">
                <bean-el:message
                  key="bp.report.jdbcResourceView.label.url"
                  bundle="bp.messages"
                />:
              </td>
              <td valign="top" width="34%" class="labelField">
                <c:out value="${resource.url}"/>&nbsp;
              </td>
            </tr>
            <tr>
              <td valign="middle" width="16%" class="label">
                <bean-el:message
                  key="bp.report.jdbcResourceView.label.user"
                  bundle="bp.messages"
                />:
              </td>
              <td valign="top" width="34%" class="labelField">
                <c:out value="${resource.user}"/>&nbsp;
              </td>
              <td valign="middle" width="16%" class="label">
                <bean-el:message
                  key="bp.report.jdbcResourceView.label.password"
                  bundle="bp.messages"
                />:
              </td>
              <td valign="top" width="34%" class="labelField">
                <c:if test="${!empty resource.password}">*****</c:if>&nbsp;
              </td>
            </tr>
            <tr>
              <td valign="middle" width="16%" class="label">
                <bean-el:message
                  key="bp.report.jdbcResourceView.label.pool"
                  bundle="bp.messages"
                />:
              </td>
              <td valign="top" width="34%" class="labelField">
                <c:out value="${resource.pool}"/>&nbsp;
              </td>
              <td valign="middle" width="16%" class="label">&nbsp;</td>
              <td valign="top" width="34%" class="labelField">&nbsp;</td>
            </tr>
          </c:otherwise>
        </c:choose>
      </table>
    </td>
  </tr>
</table>

<!-- =============================================================
  ** vim: set ts=2 expandtab syntax=jsp:
  -->
